package jnpf.htgl.enums;

import com.google.common.collect.Lists;

import java.util.List;
import java.util.Objects;

/**
 * 合同管理_费用项枚举
 */
public enum ExpenseTypeEnum {

    TYPE_1("1","房屋租金"),
    TYPE_2("2","物业"),
    TYPE_3("3","其他费用"),
    ;

    String code;
    String desc;

    ExpenseTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }


    public static List<String> getAllType() {
        List<String> typeList = Lists.newArrayList();
        for (ExpenseTypeEnum c : ExpenseTypeEnum.values()) {
            typeList.add(c.getDesc());
        }
        return typeList;
    }

    public static String getDescByCode(String code) {
        for (ExpenseTypeEnum c : ExpenseTypeEnum.values()) {
            if (Objects.equals(c.getCode(), code)) {
                return c.getDesc();
            }
        }
        return "无此费用项枚举规则";
    }


}
